package com.beteng.su.betengsu.ui.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.beteng.su.betengsu.R;
import com.beteng.su.betengsu.base.APPConstants;
import com.beteng.su.betengsu.bean.UserBean;
import com.beteng.su.betengsu.widget.CircleTransform;
import com.blankj.utilcode.util.CacheUtils;
import com.czm.settingview.SettingItem;
import com.squareup.picasso.Picasso;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import cn.droidlover.xdroid.base.XFragment;

/**
 * Created by chenzhimin on 2017/9/6.
 */

public class SettingFragment extends XFragment {

    @BindView(R.id.headimage)
    ImageView mHeadimage;
    @BindView(R.id.setting_username)
    TextView mSettingUsername;
    @BindView(R.id.item_four)
    SettingItem mItemFour;
    @BindView(R.id.item_location)
    SettingItem mItemLocation;
    Unbinder unbinder;

    public static SettingFragment newInstance() {

        Bundle args = new Bundle();

        SettingFragment fragment = new SettingFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        Picasso.with(getContext()).load(R.mipmap.user_icon).transform(new CircleTransform()).into(mHeadimage);

        UserBean userBean = (UserBean) CacheUtils.getInstance().getSerializable( APPConstants.SP_USER);
        if (userBean != null) {
            mSettingUsername.setText(userBean.getUserName());
        }
    }

    @Override
    public int getLayoutId() {
        return R.layout.fragment_setting;
    }

}
